/*
 * @Author: your name
 * @Date: 2020-06-02 11:44:57
 * @LastEditTime: 2020-06-03 11:16:01
 * @LastEditors: Please set LastEditors
 * @Description: 用户信息
 * @FilePath: \mobile_project_0519\mobile_post\src\store\modules\user.js
 */ 

 let userModule = {
     namespaced:true,
     state:{
         token:localStorage.getItem("token") || ""  //密钥
     },
     mutations:{
        //  获取密钥
        ["GET_TOKEN"](state,token){
             state.token = token
             localStorage.setItem("token",state.token)
         },
         //  删除密钥
        ["REMOVE_TOKEN"](state){
            state.token = ""
            localStorage.removeItem("token")
        },
        //  获取用户名
        ["GET_NAME"](state,name){
            state.name = name
            localStorage.setItem("name",state.name)
        },
     }
 }

 export default userModule